package com.example.vv.model.splash;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import com.example.vv.R;
import com.example.vv.frameWork.mvp.MvpActivity;
import com.example.vv.model.main.MainAct;
import com.example.vv.model.splash.base.contract.SplashContract;
import com.example.vv.model.splash.base.presenter.SplashPresenter;

import butterknife.BindView;

/**
 *
 */
public class SplashAct extends MvpActivity<SplashContract.View, SplashPresenter> implements SplashContract.View{
    @BindView(R.id.splash_image)
    ImageView splashImage;

    @Override
    public int initLayout() {
        return R.layout.act_splash;
    }

    @Override
    public SplashPresenter initPresenter() {
        return new SplashPresenter();
    }

    @Override
    public void initView() {
        Animation animation = AnimationUtils.loadAnimation(this, R.anim.splash_in);
        splashImage.startAnimation(animation);
    }

    @Override
    public void initData() {

    }

    @Override
    public void doBusiness() {
        jump();
    }

    @Override
    public View titleVIew() {
        return null;
    }

    private void jump() {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                    startActivity(new Intent(SplashAct.this, MainAct.class));
            }
        },2000);
    }


    @Override
    public Context getMContext() {
        return this;
    }
}
